Skip to content

update ChatCompletionResponse.Created filed ,support return Created type is string #1003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from

Conversation

dragonTalon
Copy link

@dragonTalon dragonTalon commented May 16, 2025

ChatCompletionResponse.Created filed support compatibility between int64 and string formats. and created is null

Created             interface           `json:"created,omitempty"`

Issue: #1002

talonjian added 5 commits May 16, 2025 16:54
Copy link

codecov bot commented May 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.93%. Comparing base (4d2e7ab) to head (c201836).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1003   +/-   ##
=======================================
  Coverage   85.93%   85.93%           
=======================================
  Files          43       43           
  Lines        2268     2268           
=======================================
  Hits         1949     1949           
  Misses        300      300           
  Partials       19       19           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dragonTalon
Copy link
Author

@kmesiab

@sashabaranov
Copy link
Owner

@dragonTalon thank you for the PR! OpenAI docs specify that the type of this object is integer here https://platform.openai.com/docs/api-reference/chat/object#chat/object-created

Are you using a non-OpenAI api by any chance?

@stmcginnis
Copy link
Contributor

OpenAI also publishes an official schema now. This should remain an integer value, not a string.

@dragonTalon
Copy link
Author

@dragonTalon thank you for the PR! OpenAI docs specify that the type of this object is integer here https://platform.openai.com/docs/api-reference/chat/object#chat/object-created

Are you using a non-OpenAI api by any chance?

yeal ! we trying other model ,they return created format for string.
we believe that discrepancies in the 'created' field should not hinder the usage of go-openai.

@stmcginnis
Copy link
Contributor

we believe that discrepancies in the 'created' field should not hinder the usage of go-openai

The right answer here is that whatever software you are using to host that model should be fixed to return the correct data type. It should not be up to this library to deviate from the official schema to work around a bug in one implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants